package com.lglbc.day14;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author 乐哥聊编程
 * @Doc 关注公众号"乐哥聊编程"获取文档和源码
 * @Date 2023/4/13
 * @Description
 */
@RequestMapping
@RestController
public class IndexController {

    @RequestMapping("/user")
    @PreAuthorize("hasRole('user')")
    public String user() {
        return "hello";
    }
    @RequestMapping("/admin")
    @PreAuthorize("hasRole('admin')")
    public String admin() {
        return "admin";
    }
}
